package com.igoal.dto;

import java.util.Calendar;
import java.util.Date;

import com.igoal.utils.BaseSynchronizeAttributeWithOther;

public abstract class BaseDTO<T> extends BaseSynchronizeAttributeWithOther<T> {
	protected Long id;

	protected Integer createdDate;
	protected Integer createdMonth;
	protected Integer createdYear;

	protected Integer updatedDate;
	protected Integer updatedMonth;
	protected Integer updatedYear;

	protected boolean isYouLikeThis;	
	protected boolean isYouCheerThis;
	
	protected Long updateDate;
	/**
	 * minutes
	 */
	protected Long updatedSince;

	public Long getUpdatedSince() {
		return updatedSince;
	}

	public void setUpdatedSince(Long updatedSince) {
		this.updatedSince = updatedSince;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Integer createdDate) {
		this.createdDate = createdDate;
	}

	public Integer getCreatedMonth() {
		return createdMonth;
	}

	public void setCreatedMonth(Integer createdMonth) {
		this.createdMonth = createdMonth;
	}

	public Integer getCreatedYear() {
		return createdYear;
	}

	public void setCreatedYear(Integer createdYear) {
		this.createdYear = createdYear;
	}

	public Integer getUpdatedDate() {
		return updatedDate;
	}

	public void setUpdatedDate(Integer updatedDate) {
		this.updatedDate = updatedDate;
	}

	public Integer getUpdatedMonth() {
		return updatedMonth;
	}

	public void setUpdatedMonth(Integer updatedMonth) {
		this.updatedMonth = updatedMonth;
	}

	public Integer getUpdatedYear() {
		return updatedYear;
	}

	public void setUpdatedYear(Integer updatedYear) {
		this.updatedYear = updatedYear;
	}

	public Long getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Long updateDate) {
		this.updateDate = updateDate;
	}

	protected void transformCreatedDate(Date dCreatedDate) {
		if (dCreatedDate == null)
			return;

		Calendar calendar = Calendar.getInstance();
		calendar.setTime(dCreatedDate);

		createdDate = calendar.get(Calendar.DATE);
		createdMonth = calendar.get(Calendar.MONTH) + 1;
		createdYear = calendar.get(Calendar.YEAR);
	}

	protected void transformUpdatedDate(Date dUpdatedDate) {
		if (dUpdatedDate == null)
			return;

		Calendar calendar = Calendar.getInstance();
		calendar.setTime(dUpdatedDate);

		updatedDate = calendar.get(Calendar.DATE);
		updatedMonth = calendar.get(Calendar.MONTH) + 1;
		updatedYear = calendar.get(Calendar.YEAR);
	}
}
